/**
 * Created by charsen on 16/6/5.
 */
/**
 * Created by charsen on 16/5/25.
 */
directives.directive('inputEdit', ["$rootScope", "tools", "$timeout", "$location", function ($rootScope, tools, $timeout, $location) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attr) {
            scope.shown = false;
            scope.content = "";
            var cb = null;

            $rootScope.$on('INPUT_EDIT_EV', function (e, content_, cb_) {
                scope.shown = true;
                scope.content = content_;
                cb = cb_;
            });

            scope.ok = function (e) {
                e.stopPropagation();
                if (cb) {
                    cb(scope.content);
                }
                scope.shown = false;
            }
        },
        templateUrl: "/trend-new-BI/app/components/common/chartManager/inputEdit/inputEdit.html"
    }
}]);